<?php
declare (strict_types=1);

namespace app\command;

use app\admin\model\base\SysConfig;
use emqx\EmqxMqttClient;
use think\console\Command;
use think\console\Input;
use think\console\Output;

/**
 * MQTT接收设备消息命令
 */
class MqttSubscribe extends Command
{
    protected function configure()
    {
        // 指令配置
        $this->setName('MqttSubscribe')->setDescription('MQTT接收设备消息命令');
    }

    protected function execute(Input $input, Output $output)
    {
        //加载系统配置
        SysConfig::cleanUpConfig();
        SysConfig::loadConfig();
        //执行mqtt订阅程序
        $Subscribe = new EmqxMqttClient();
        $Subscribe->subscribeMqtt();
    }

}
